﻿@model IEnumerable<Project.Database.Blog>
@{
    ViewBag.Title = "List";
}
@if (Model.Count() == 0)
{
    <b>No blogs have been added yet...</b>
}
else
{

    <h2>
        List</h2>

    <table>
        <tr>
            <th>
                UserID
            </th>
            <th>
                CategoryID
            </th>
            <th>
                Name
            </th>
            <th>
                URL
            </th>
            <th>
                Keywords
            </th>
            <th>
                Timestamp
            </th>
            <th>
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.ActionLink(item.User.UserName, "List", new { userid = item.UserID })
                </td>
                <td>
                    @Html.ActionLink(item.BlogCategory.Name, "List", new { catid = item.CategoryID })
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.URL)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Keywords)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Timestamp)
                </td>
                <td>
                    @Html.ActionLink("Details", "Details", new { id = item.ID })
                </td>
            </tr>
        }
    </table>

}
